//
//  JKHorizontalGrideView.h
//  JKHorizontalGrideView
//
//  Created by jiukuyinyue on 2017/8/18.
//  Copyright © 2017年 LC. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "JKHorizontalGrideCollectionViewLayout.h"


@interface JKHorizontalGrideViewCellConfig: NSObject

@property (nonatomic, copy) void(^cellConfigBlock) (UILabel *titleLabel,UIImageView     *iconImageView,UICollectionViewCell *cell);
// 设置行数
@property (nonatomic, assign) NSInteger rowCount;
// 设置列数
@property (nonatomic, assign) NSInteger columnCount;

INTERFACE_SINGLETON(JKHorizontalGrideViewCellConfig)

@end

/*
 依赖库
 1. Masonry
 2. SDWebImage
 设置默认 2行数
 设置默认 4列数
 */

@class JKHorizontalGrideView;

@protocol JKHorizontalGrideViewDataSource <NSObject>

@optional
/**
 提供数据的数量
 
 @param horizontalGrideView 控件本身
 @return 返回数量
 */
- (NSInteger)numberOfItemsInHorizontalGrideView:(JKHorizontalGrideView *)horizontalGrideView;


/**
 提供选项标题
 
 @param horizontalGrideView 当前控件
 @param index 选项下标
 @return 返回标题
 */
- (NSString *)horizontalGrideView:(JKHorizontalGrideView *)horizontalGrideView titleForItemAtIndex:(NSInteger)index;


/**
 提供选项的图标地址路径
 
 @param horizontalGrideView 当前控件
 @param index 选项下标
 @return 返回图标
 */
- (NSString *)horizontalGrideView:(JKHorizontalGrideView *)horizontalGrideView iconURLForItemAtIndex:(NSInteger)index;

@end

@protocol JKHorizontalGrideViewDelegate <NSObject>

@optional
/**
 当选项被点击回调
 
 @param horizontalGrideView 当前控件
 @param index 点击下标
 */
- (void)horizontalGrideView:(JKHorizontalGrideView *)horizontalGrideView didSelectItemAtIndex:(NSInteger)index;

/**
 返回当前选中的pageControl 颜色
 
 @param horizontalGrideView 当前控件
 @return 颜色
 */
- (UIColor *)colorForCurrentPageControlInHorizontalGrideView:(JKHorizontalGrideView *)horizontalGrideView;
@end


/**
 横向网格控件
 */
@interface JKHorizontalGrideView : UIView

@property (strong, nonatomic)   UICollectionView    *collectionView;

@property (weak, nonatomic) id<JKHorizontalGrideViewDataSource> dataSource;

@property (weak, nonatomic) id<JKHorizontalGrideViewDelegate>   delegate;

@property (strong, nonatomic)   UIImage                         *defaultImage;

/**
 刷新
 */
- (void)reloadData;
@end
